package com.zzptc.zzsgz.bdsjws.fragments;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.zzptc.zzsgz.bdsjws.MyApplication;
import com.zzptc.zzsgz.bdsjws.R;
import com.zzptc.zzsgz.bdsjws.adapter.Add_Contacts_Adapter;
import com.zzptc.zzsgz.bdsjws.fragments.base.BaseFragment;
import com.zzptc.zzsgz.bdsjws.vo.Contacts;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/6/6.
 */

public class Search_Contacts_Fragment extends BaseFragment {

    private RecyclerView recyclerView;
    private List<Contacts> mList=new ArrayList<>();
    public Add_Contacts_Adapter add_contacts_adapter;
    private TextView textView;

    @Override
    public int getXML() {
        return R.layout.search_contacts_frag_layout;
    }

    @Override
    public void initView() {
        recyclerView = (RecyclerView) getThisView().findViewById(R.id.recyclerview_search_contacts);
        textView = (TextView) getThisView().findViewById(R.id.tv_search_no);
        recyclerView.setLayoutManager(new LinearLayoutManager(MyApplication.getContext()));
        add_contacts_adapter = new Add_Contacts_Adapter(mList);
        recyclerView.setAdapter(add_contacts_adapter);
    }

    @Override
    public void initDate() {

    }

    public void setList(List<Contacts> list,int i){
        this.mList.clear();
        this.mList.addAll(list);
        add_contacts_adapter.notifyDataSetChanged();
        textView.setVisibility( i > 0 ? View.GONE : View.VISIBLE);
    }
}
